package com.tanlu.tcc.mq;

import com.tanlu.tcc.domain.Command;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Sender {

    @Autowired
    private AmqpTemplate rabbitmqTemplate;

    public void send(Command command){
        System.out.println("Sender:" +command);
        this.rabbitmqTemplate.convertAndSend("fanout-exchange",null, command);
    }

}
